import 'package:flutter/material.dart';
import 'package:haokezufang/widgets/common_image.dart';

import 'function_button_data.dart';

class FunctionButtonItemWidget extends StatelessWidget {
  final FunctionButtonItem data;

  const FunctionButtonItemWidget({super.key, required this.data});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: () => {
        if (data.onTapHandle != null) {data.onTapHandle!(context)}
      },
      child: Container(
        padding: const EdgeInsets.only(top: 20),
        width: MediaQuery.of(context).size.width * 0.33,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            CommonImage(
              src: data.imageUrl,
              width: 40,
              height: 40,
              fit: BoxFit.contain,
            ),
            const Padding(padding: EdgeInsets.all(4)),
            Text(data.title)
          ],
        ),
      ),
    );
  }
}
